package com.dbappsecurity.bifrost.di.module;

import android.view.View;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import com.dbappsecurity.bifrost.di.scope.ActivityScope;
import com.dbappsecurity.bifrost.di.scope.FragmentScope;
import com.dbappsecurity.core.CoreBaseFragment;
import com.tbruyelle.rxpermissions2.RxPermissions;
import dagger.Module;
import dagger.Provides;
import io.reactivex.disposables.CompositeDisposable;

@Module
public class FragmentModule {

  private CoreBaseFragment mFragment;

  public FragmentModule(CoreBaseFragment fragment) {
    this.mFragment = fragment;
  }

  @Provides
  @FragmentScope
  public RxPermissions provideRxPermission() {
    return new RxPermissions(mFragment.getActivity());
  }

  @Provides
  @FragmentScope
  public Unbinder getViewBinder(View view) {
    return ButterKnife.bind(mFragment, view);
  }

  @Provides
  @FragmentScope
  public CompositeDisposable getDisposables() {
    return new CompositeDisposable();
  }
  //
  //
  //@Provides
  //@ActivityScope
  //public StringBuilder getStringBuilder() {
  //  return new StringBuilder();
  //}
}
